<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="copyright" content="http://www.appcms.org" />
<link rel="stylesheet" href="skin/base.css">
<link rel="stylesheet" href="skin/form.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/config.js"></script>
<script src="js/common.js"></script>
</head>
<body>
<div id="main">
	<div class="form">
		<p class='p2'><script>document.write(localStorage['talk_content']);</script></p>
    	<div class="items">
	         <div class="item">
	            	<div class="txt">
						<textarea id="content" name="content" maxlength="240" placeholder="回复~"  onkeypress="getRealLen(this.value);" oninput="getRealLen(this.value);"></textarea>
						<div class="em">
							<div class="l"></div>
							<div class="r" id="words">240</div>
						</div>
					</div>
	          </div>
        </div>	
    </div>
</div>
</body>
<script>
	zy_init();
	var strlen=0;
	var Status=false;
	function getRealLen(str){
		strlen=str.replace(/[^\x00-\xff]/g,'__').length;
		
		$$('words').innerHTML=int(240-strlen);
		if(strlen>240){			
			$$('content').value=substr(str,240);
		}
		
	}

	function postdata(){
		if(Status){return false;}
		if (!c_l()) {
			gologin();
			return false;
		}
		
		var Content=trim($$('content').value);
		if(Content==''){uexWindow.alert('','评论内容不能为空','关闭');return false;}
		if(strlen>240){
			uexWindow.alert('','评论内容超出240字节','关闭');return false;
		}
		uexWindow.toast(1, 5, '评论提交中...', 0);
		var url = app_path+'index.php?m=iappTalk&c=app&a=reply_add&userid='+localStorage['u_id']+'&acctoken='+localStorage['u_acctoken'];
		uexXmlHttpMgr.open(-1,'post',url,"8000");
		uexXmlHttpMgr.setPostData(-1,'0','talkid',localStorage['talk_id']);
		uexXmlHttpMgr.setPostData(-1,'0','content',Content);
		uexXmlHttpMgr.setPostData(-1,'0','reply_userid',localStorage['reply_userid']);
		uexXmlHttpMgr.setPostData(-1,'0','reply_nick',localStorage['reply_nick']);
		uexXmlHttpMgr.send(-1);
		Status=true;
	}
	
	window.uexOnload=function(type){
		if (!type) {
			uexWindow.evaluateScript('',0,"$$('content').className='';");
			uexWindow.setBounce("1");
			
			$$('content').placeholder="回复："+localStorage['reply_nick'];
			
			uexXmlHttpMgr.onData = function(opId, status, data){
				uexWindow.closeToast();
				uexXmlHttpMgr.close(opId);
				if (status == 1) {
					data=JSON.parse(data);
					uexXmlHttpMgr.close(opId);
					Status = false;
					if (data['success'] == 'NOLOGIN') {
						gologin();
					}else if (data['success'] == 'NOTALK'){
						uexWindow.evaluatePopoverScript('talk_item','content','Get(\'0\')');
						uexWindow.evaluateScript('',0,'uexWindow.close(-1)');
					}else if(data['success'] == 'OK'){
						uexWindow.evaluatePopoverScript(localStorage['answer'],'content','ok_answer()');
						uexWindow.evaluateScript('talk_answer',0,'uexWindow.close(1)');
					}else{
						uexWindow.alert('', data['msg'], '关闭');
					}
				}else if (status == -1) {
						Status = false;
						uexWindow.alert('', '答案提交超时', '关闭');
				}
			}
		}
	}
	</script>
</html>